<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
    <%@include file="/views/common/include/taglib.jsp"%>
    <%@include file="/views/common/include/head.jsp"%>
    <link rel="stylesheet" href="${ctx}/css/page/header2.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/page/reset.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/page/person-left.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/page/footer.css" type="text/css">
    <link rel="stylesheet" href="${ctx}/css/page/owneraddress.css" type="text/css">
<script src="${ctx}/js/controllers/base/ownerAddressController.js" type="text/javascript"></script>
	<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
	</script>	
</head>
<body>
	<jsp:include page="/views/common/head_main.jsp" />
	<div class="bg">
		<div class="contentbox1 contentbox">
			<div class="leftlist">
		        <div class="myorder left">
					<ul>
						<li><a class="order" href="${ctx}/orderInfo/orderInfoListByState" >我的订单</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=0">待付款</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=1">待商家确认</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=2">待发货</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=3,14">待收货</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=6,7,8,10,11,12,13">退款售后</a></li>
					</ul>
				</div>
				<div class="myproperty left">
					<ul>
						<li class="order">我的物业</li>
						<c:if test="${displayFeeBill == 1}">
						<li><a href="${ctx}/propertyBill/getMyBill">我的物业费</a></li>
						</c:if>
						<c:if test="${displayCar == 1}">
						<li><a href="${ctx}/carBill/getCarManage">我的停车费</a></li>
						</c:if>
						<li><a href="${ctx}/propertyRepair/infoList">我的物业报修</a></li>
						<li><a href="${ctx}/propertySuggestion/infoList">我的物业投诉</a></li>
					</ul>
				</div>
				<div class="myassets left">
					<ul>
						<li class="order">我的资产</li>
					    <li><a href="${ctx}/ownerTreasure/ownerIntegralChangeList?state=0&pNo=1">我的积分</a></li>
						<li><a href="${ctx}/ownerTreasure/getCouponList?pNo=1">优惠券</a></li>
					</ul>
				</div>
				<div class="otherlist left">
					<ul class="others">
						<li class="order">其他</li>
						<li><a href="${ctx}/ownerOther/getMyCollection">我的收藏</a></li>
						<li><a style="color:red;" href="${ctx}/ownerAddress/ownerAddressList">我的收货地址</a></li>
						<li><a href="${ctx}/complaintsInfo/infoList">我的投诉建议</a></li>
						<li><a href="${ctx}/ownerHouse/ownerHouseList">我的小区</a></li>
						<!-- position需要跳转到特定位置 -->
						<li><a href="${ctx}/main?item=1#openShop">我要开店</a></li>
						<li><a href="${ctx}/usualQuestions/infoList">常见问题</a></li>
					</ul>
				</div>
			</div>
			<%-- <jsp:include page="/views/main/main_personal_left.jsp" /> --%>
            <div class="rightlist">
            <input type="hidden" id="item" value="${sessionScope.item_personal}"/>
                <div class="rightbox">
                	<span class="word title">管理收货地址</span><hr class="line">
                	<h3 class="new">新增收货地址</h3>
                	<input id="addressId" type="hidden" value="${ownerAddress.id }">
					<form class="addressment">
						<table class="table-address">
							<tr>
								<td><h4 class="left-td">收件人：<em class="emStyle">*</em></h4></td>
								<td><input id="recepientName" maxlength="50" onblur="checkRecepientName()" value="${ownerAddress.recepientName }" class="input-text" type="text" placeholder="不能为昵称，x先生、x小姐等"/></td>
							</tr>
							<tr>
								<td><h4 class="left-td addr-left">收货地址：<em class="emStyle">*</em></h4></td>
								<td>
									<select id="cellRegionId" class="OASelect" onblur="checkCellRegion()" >
										<option value="">--区域--</option>
			                   			<c:if test="${not empty cellRegions}">
			                   				<c:forEach items="${cellRegions}" var="cellRegion" varStatus="status">
				                  				<c:if test="${cellRegion.name == cellHouse.regionName}">
					                  				<option id="${cellRegion.name}" value="${cellRegion.id}" selected>
					                  					${cellRegion.name}
					                  				</option>
				                  				</c:if>
				                  				<c:if test="${cellRegion.name != cellHouse.regionName}">
				                  				<option id="${cellRegion.name}" value="${cellRegion.id}">
				                  					${cellRegion.name}
				                  				</option>
			                  				</c:if>
			                  				</c:forEach>
			                   			</c:if>
									</select>
									<select id="cellUnitId" class="OASelect addr-right" onblur="checkCellUnit()" >
										<option value="">--单元--</option>
			                   			<c:if test="${not empty cellUnits}">
			                   				<c:forEach items="${cellUnits}" var="cellUnit" varStatus="status">
				                  				<c:if test="${cellUnit.name == cellHouse.unitName}">
					                  				<option id="${cellUnit.name}" value="${cellUnit.id}" selected>
					                  					${cellUnit.name}
					                  				</option>
				                  				</c:if>
				                  				<c:if test="${cellUnit.name != cellHouse.unitName}">
				                  				<option id="${cellUnit.name}" value="${cellUnit.id}">
				                  					${cellUnit.name}
				                  				</option>
			                  				</c:if>
			                  				</c:forEach>
			                   			</c:if>
									</select>
								</td>
								<td>
									<select id="cellBuildingId" class="OASelect" onblur="checkCellBuilding()" >
										<option value="">--楼栋--</option>
			                   			<c:if test="${not empty cellBuildings}">
			                   				<c:forEach items="${cellBuildings}" var="cellBuilding" varStatus="status">
				                  				<c:if test="${cellBuilding.buildingName == cellHouse.buildingName}">
					                  				<option id="${cellBuilding.buildingName}" value="${cellBuilding.id}" selected>
					                  					${cellBuilding.buildingName}
					                  				</option>
				                  				</c:if>
				                  				<c:if test="${cellBuilding.buildingName != cellHouse.buildingName}">
				                  				<option id="${cellBuilding.buildingName}" value="${cellBuilding.id}">
				                  					${cellBuilding.buildingName}
				                  				</option>
			                  				</c:if>
			                  				</c:forEach>
			                   			</c:if>
									</select>
									<select id="cellHouseId" class="OASelect addr-right" onblur="checkCellHouse()" >
										<option value="">--房屋--</option>
										<c:if test="${not empty cellHouses}">
											<c:forEach items="${cellHouses}" var="cellHouse" varStatus="status">
												<option id="${cellHouse.name}" value="${cellHouse.id}" selected>
													${cellHouse.name}
												</option>
											</c:forEach>
										</c:if>
									</select>
								</td>
							</tr>
							<tr>
								<td><h4 class="left-td">手机号码：<em class="emStyle">*</em></h4></td>
								<td><input id="phone" value="${ownerAddress.recepientPhone }" class="input-text" type="text" onblur="checkPhone()" ></td>
							</tr>
							<tr>
								<td class="default-td"></td>
								<td class="default-td">
								<c:if test="${ownerAddress.defaultFlag == 1}">
									<input id="defaultAddress" type="checkbox" class="check" checked="checked">
								</c:if>
								<c:if test="${ownerAddress.defaultFlag != 1}">
									<input id="defaultAddress" type="checkbox" class="check">
								</c:if>
								<span class="check-style">设为默认地址</span></td>
							</tr>
						</table>
					</form>
					<h3><a onclick="saveAddress()" class="but">保存收货地址</a></h3>
					<div class="list">
						<span class="word">已保存的地址</span>
						<div class="list-div list-count line"><span>已保存了${count}条地址，还能保存${10-count}条地址</span></div>
						<div class="list-div">
							<table class="table">
								<thead>
									<tr>
										<th width="15%">收货人</th>
				                        <th width="25%">收货地址</th>
				                        <th width="20%">手机</th>
				                        <th width="20%">操作</th>
				                        <th width="20%"></th>
									</tr>	
								</thead>
								<tbody>
									<c:forEach items="${ownerAddressList}" var="item" varStatus="ownerAddressStatus">
					                	<tr class="tr-border">
					                        <td>${item.recepientName}</td>
					                        <td>${item.detailAddress}</td>
					                        <td>${item.recepientPhone}</td>
					                        <td class="caozuo">
					                          	<a class="fa" href="${ctx}/ownerAddress/ownerAddressList?addressId=${item.id}">修改</a>
					                          	<span>&nbsp;&nbsp;</span>
					                          	<a class="fa" onclick="deleteAddress(${item.id})">删除</a>
					                        </td>
					                        <td>
						                        <c:if test="${item.defaultFlag == 1}">
						                        	<img src="${ctx}/images/page/flag-default.png">
						                        </c:if>
						                        <c:if test="${item.defaultFlag != 1}">
						                        	<div onclick="changeDefault(${item.id})"><img src="${ctx}/images/page/flag-normal.png"></div>
						                        </c:if>
					                        </td>
					                     </tr>
					                 </c:forEach>
								</tbody>							
							</table>
						</div>
					</div>
				</div>
				<div class="content">
				</div>
			</div> 
		</div>
	</div>
	<jsp:include page="/views/common/footer.jsp" />
</body>
</html>

